import { Tag } from 'antd';
import { ColumnsRenderFun, DictionaryRenderFun, formatDecimal, getSorter } from '../../Acommon';

export const MothedChangeColumns = (): Record<string, any>[] => {
  return [
    {
      title: '标包名称',
      dataIndex: 'packName',
      key: 'packName',
      visible: true,
      width: 250,
      fixed: 'left',
      sorter: (a: any, b: any) => getSorter(a?.packName, b?.packName),
      render: (text: string) => ColumnsRenderFun({ text, isTooltip: true }),
    },
    {
      title: '标包编号',
      dataIndex: 'packCode',
      key: 'packCode',
      visible: true,
      width: 150,
      sorter: (a: any, b: any) => getSorter(a?.packCode, b?.packCode),
      render: (text: string) => ColumnsRenderFun({ text, isTooltip: true }),
    },
    {
      title: '预算金额',
      dataIndex: 'expectSum',
      key: 'expectSum',
      visible: true,
      width: 150,
      sorter: (a: any, b: any) => getSorter(a?.expectSum, b?.expectSum),
      render: (text: string) => formatDecimal(text),
    },
    {
      title: '采购组织类型',
      dataIndex: 'procureOrgName',
      key: 'procureOrgName',
      width: 180,
      sorter: (a: any, b: any) => getSorter(a?.procureOrg, b?.procureOrg),
      visible: true,
      render: (text: string) => DictionaryRenderFun({ text }),
    },
    {
      title: '拟采用采购方式',
      dataIndex: 'procureRealName',
      key: 'procureRealName',
      width: 180,
      sorter: (a: any, b: any) => getSorter(a?.procureReal, b?.procureReal),
      visible: true,
      render: (text: string) => DictionaryRenderFun({ text }),
    },
    {
      title: '采购类别',
      dataIndex: 'supplyTypeName',
      key: 'supplyTypeName',
      visible: true,
      width: 150,
      sorter: (a: any, b: any) => getSorter(a?.supplyTypeName, b?.supplyTypeName),
      render: (text: string) => DictionaryRenderFun({ text, isTooltip: true }),
    },
    {
      title: '标的来源',
      dataIndex: 'supplyWay',
      key: 'supplyWay',
      visible: true,
      width: 150,
      sorter: (a: any, b: any) => getSorter(a?.supplyWay, b?.supplyWay),
      render: (text: string | number) => {
        return <div>{text == 0 ? '月度计划' : text == 1 ? '零星采购' : text == 2 ? '实验平台' : '--'}</div>;
      },
    },
    {
      title: '是否变更中',
      dataIndex: 'changeFlag',
      key: 'changeFlag',
      visible: true,
      width: 120,
      sorter: (a: any, b: any) => getSorter(a?.changeFlag, b?.changeFlag),
      render: (text: number) => {
        return text ? '是' : '否';
      },
    },
  ];
};
